﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Vowei.Data;
using Vowei.Core.Models;
using Vowei.Data.Models;
using Vowei.Web;

namespace vowei.web.Controllers
{
    public class PermissionControllerBase<T> : G18nController
        where T : Permission
    {
        private IVoweiContext _context;
        public PermissionControllerBase(IVoweiContext context)
        {
            _context = context;
        }

        public ActionResult Index()
        {
            var table = _context.Resolve<T>().Query;
            return new JsonResult() { Data = table.ToArray() };
        }
    }

    public class PermissionController : PermissionControllerBase<Permission>
    {
        public PermissionController(IVoweiContext context) : base(context) { }
    }
}
